package com.test.clyq.serviceImpl;

import java.util.List;

import com.test.clyq.dao.QuestionDao;
import com.test.clyq.entity.Question;
import com.test.clyq.entity.Users;
import com.test.clyq.service.QuestionService;
import com.test.service.impl.BaseManager;
import com.test.util.Pagination;

/**
 * QuestionServiceImpl. <br>
 * 问题管理.
 * <p>
 * Copyright: Copyright (c) 2010-3-17 下午04:30:46
 * <p>
 * Company: 北京宽连十方数字技术有限公司
 * <p>
 * Author: liuxl@c-platform.com
 * <p>
 * Version: 1.0
 * <p>
 */
public class QuestionServiceImpl extends BaseManager implements QuestionService {

	private QuestionDao downFileDao;

	/**
	 * 添加问题
	 * 
	 * @param file
	 * @param user
	 */
	public void addQuestion(Question file, Users user) {
		downFileDao.addQuestion(file, user);
	}

	/**
	 * 删除问题
	 * 
	 * @param id
	 * @param user
	 */
	public boolean deleteQuestion(Long id, Users user) {
		return downFileDao.deleteQuestion(id, user);
	}

	public QuestionDao getDownFileDao() {
		return downFileDao;
	}

	/**
	 * 获取一个问题
	 * 
	 * @param id
	 * @return
	 */
	public Question getOneQuestion(Long id) {
		return downFileDao.getOneQuestion(id);
	}

	/**
	 * 通过分页获取问题
	 * 
	 * @param pagination
	 * @param categoryId
	 * @return
	 */
	public List<Question> getQuestionByPage(Pagination pagination, Long categoryId) {
		return downFileDao.getQuestionByPage(pagination, categoryId);
	}

	public void setDownFileDao(QuestionDao downFileDao) {
		this.downFileDao = downFileDao;
	}

	/**
	 * 修改问题
	 * 
	 * @param id
	 * @param user
	 */
	public void updateQuestion(Question file, Users user) {
		downFileDao.updateQuestion(file, user);
	}
}
